#include "dataentry.h"

/** AIRPORT Sample Entries
airport_ID	name		city		country				IATA	ICAO	lat			lon			altitude	timezone	DST
507			"heathrow"	"london"	"united kingdom"	"lhr"	"egll"	51.4775		-0.461389	83			0			"e"
26			"kugaaruk"	"pelly bay"	"canada"			"ybb"	"cybb"	68.534444	-89.808056	56			-6			"a"
3127		"pokhara"	"pokhara"	"nepal"				"pkr"	"vnpk"	28.200881	83.982056	2712		5.75		"n"
*/

AirportEntry::AirportEntry(int id, const QString& name, const QString& city, const QString& country, const QString& iata, const QString& icao, double latitude, double longitude, double altitude, double timezone, const QString& dst):
				airport_ID(id), 
				name(name),
				city(city),
				country(country),
				IATA(iata),
				ICAO(icao), 
				latitude(latitude),
				longitude(longitude),
				altitude(altitude),
				timezone(timezone),
				DST(dst) {
}

DataEntry::EntryType AirportEntry::getType() {
	return Airport;
}

QString AirportEntry::toString() {
	return	QString::number(airport_ID) + ", " +
			name + ", " + 
			city + ", " + 
			country + ", " + 
			IATA + ", " + 
			ICAO + ", " + 
			QString::number(latitude) + ", " + 
			QString::number(longitude) + ", " + 
			QString::number(altitude) + ", " + 
			QString::number(timezone) + ", " + 
			DST;
}

/** ROUTE Sample Entries
airline	airlineID	origin	originID	dest	destID	codeshare	stops	equip
BA		1355		SIN		3316		LHR		507					0		744 777
BA		1355		SIN		3316		MEL		3339	Y			0		744
TOM		5013		ACE		1055		BFS		465					0		320
*/

RouteEntry::RouteEntry(const QString& airline, int airline_id, const QString& origin, int origin_id, const QString& destination, int destination_id, const QString& codeshare, int stops, const QString& equiment):
				airline(airline), 
				airline_ID(airline_id), 
				origin(origin), 
				origin_ID(origin_id), 
				destination(destination), 
				destination_ID(destination_id), 
				codeshare(codeshare), 
				stops(stops), 
				equipment(equiment) {
}

DataEntry::EntryType RouteEntry::getType() {
	return Route;
}

QString RouteEntry::toString() {
	return	airline + ", " +
			QString::number(airline_ID) + ", " + 
			origin + ", " + 
			QString::number(origin_ID) + ", " + 
			destination + ", " + 
			QString::number(destination_ID) + ", " + 
			codeshare + ", " + 
			QString::number(stops) + ", " + 
			equipment;
}